#include "Random.h"
#include "Item.h"

// TODO: Message if not eatable etc.
void Item::eat() {
	if (m_consumable) {
	}
}

void Item::read() {
	if (m_readable) {
	}
}

void Item::use() {
	if (m_usable) {
	}
}

void Item::drop() {
}


int Item::rollDamage() const {
	int sum = 0;
	
	// Can do this without looping but why bother?
	// This gives a more natural result.
	for (int i = 0; i < m_numDice; i++) {
		sum += Random::nextInt(m_damageDie);
	}
	
	return sum;
}

Item* Item::createTestWeapon() {
	Item* item = new Item;
	
	item->m_name = "Long Sword";
	item->m_unidentifiedName = "Long Sword (unidentified)";
	item->m_symbol.symbol = '/';
	
	item->m_damageDie = 6;
	item->m_numDice = 2;

	item->m_identified = false;
	item->m_bucStatus = UNCURSED;
	
	item->m_consumable = false;
	item->m_readable = false;
	item->m_usable = false;
	
	item->m_weight = 10;
	
	item->m_coord.x = 6;
	item->m_coord.y = 6;
	
	return item;
}